home *** CD-ROM | disk | FTP | other *** search
/ C/C++ Users Group Library 1996 July / C-C++ Users Group Library July 1996.iso / vol_200 / 297_01 / exampl7.spr < prev    next >
Text File  |  1980-01-01  |  883b  |  40 lines

  1. /* exampl7.spr */
  2. /* The cut */
  3. /* The cut is a builtin that is a control structure */
  4. /* It says roughly "stop looking for any more solutions of the
  5.    rule head which I come from"
  6.  
  7.   Here is an example consider the following program:
  8. */
  9.  
  10. ((north_american P)
  11.  (lives_in P usa)
  12.  (cut)
  13. )
  14. ((north_american P)
  15.  (lives_in P canada)
  16. )
  17.  
  18. (lives_in anca usa)
  19. (lives_in brian usa)
  20. (lives_in murray canada)
  21.  
  22. /* If you ask the following question:
  23.    
  24.   (north_american Somebody)
  25.  
  26.  you get only one answer out of an expected 3!
  27.  
  28.  This is because once execution gets to the cut no more
  29.  other solutions for the goal (north_american Somebody)
  30.  are considered
  31.  
  32.  The cut is used in the definition of "not" which is in 
  33.  sprolog.ini and it is used in the file help.spr
  34.  
  35.  If the value of Goal is a goal
  36.  then (not Goal) succeeds if and only if Goal fails.
  37. */
  38.  
  39.  
  40.